//
//  LCTimeLineCell.m
//  YinYueTai
//
//  Created by CongCong on 15-7-22.
//  Copyright (c) 2015年 CongCong. All rights reserved.
//

#import "LCTimeLineCell.h"

@implementation LCTimeLineCell
- (void)showModel:(LCTLListModel *)model
{
    [self.iconImage sd_setImageWithURL:[NSURL URLWithString:model.userinfo.icon] placeholderImage:[UIImage imageNamed:@"avatar-placeholder"]];
    self.nameLabel.text = model.userinfo.uname;
    self.descLabel.text = model.content;
    self.timeLabel.text = model.addtime_f;
    if ([model.coverimg isEqualToString:@""]) {
        self.image.hidden = YES;
    }
    else
    {
        
        self.image.hidden = NO;
        [self.image sd_setImageWithURL:[NSURL URLWithString:model.coverimg] placeholderImage:[UIImage imageNamed:@"defaultCover"]];
        NSString *wh = model.coverimg_wh;
        NSRange range = [wh rangeOfString:@"*"];
        NSString *width = [wh substringToIndex:range.location];
        NSString *hight = [wh substringFromIndex:range.location+1];
        CGFloat w = width.floatValue;
        CGFloat h = hight.floatValue;
        
        self.image.frame = CGRectMake(0, 44, kScreenSize.width-20, h*(kScreenSize.width-20)/w);
    }
    
}
- (void)awakeFromNib {
    // Initialization code
}

@end
